#ifndef _UDP_STRUCT_H
#define _UDP_STRUCT_H


#define SDI_HEAD		0x55aa55aa
#define SDI_TAIL		0xaa55aa55

typedef struct EchoStruct_CTRL{
	unsigned short workMode;
	unsigned int bak2;
	unsigned int frameNo;
	unsigned int passhz;
	unsigned short passNum;
	unsigned short distanceNum;
	unsigned short pluseNum;
	unsigned short pluseCycle;
	unsigned short pluseHz;
	unsigned short frameCycle;
	unsigned short bak3;
	unsigned short scanStepAngle;
	unsigned short bak4;
	unsigned short bak5;
	unsigned short trackNum;
	unsigned short dotNum;
	unsigned char bak[26];
}__attribute__ ((packed)) EchoStruct_CTRL; //64byte

typedef struct CHECK_CTRL{
	unsigned int ck_bak1;
	unsigned int frameNo;
	unsigned short crc_err;
	unsigned short total_crc_err;
	unsigned short frame_err;
	unsigned short total_frame_err;
	unsigned int first_lost_frame;
	unsigned int total_lost_frame;
	unsigned int total_track;
	unsigned int total_dot;
	unsigned int sys_monitor;
	unsigned char ck_bak[12];
}__attribute__ ((packed)) CHECK_CTRL; //48byte


typedef struct TrackStruct{
	unsigned int index;
	unsigned short type;
	unsigned short distance;
	unsigned short direction;
	unsigned short elevation;
} __attribute__ ((packed)) TrackStruct; //12byte

typedef struct DotStruct{
	unsigned short distance;
	unsigned short direction;
	unsigned short elevation;
} __attribute__ ((packed)) DotStruct; //6byte

typedef struct CRCStruct{
	unsigned int scanIndex;
	unsigned int frameIndex;
	unsigned short crcError;
	unsigned short crcTotalError;
	unsigned short frameError;
	unsigned short frameTotalError;
	unsigned int frameLost;
	unsigned int frameTotalLost;
	unsigned int trackTotalNum;
	unsigned int dotTotalNum;
	unsigned int sys_monitor;
	unsigned char bak[12];
}__attribute__ ((packed)) CRCStruct; //48byte


typedef struct SDIStruct{
	unsigned int head; //4byte
	unsigned short length; //2byte
	unsigned char src;
	unsigned char sysreset;
	unsigned char bak1[8];
	struct EchoStruct_CTRL ctrl1; //64byte
	struct CHECK_CTRL chk_ctrl; //48byte
	struct TrackStruct track[32]; //12*32=384byte
	struct DotStruct dot[32]; //6*32=192byte
	struct CRCStruct crc;//48byte
	unsigned char bak2[524]; //524byte
	unsigned int tail; //4byte
}__attribute__ ((packed)) SDIStruct; //1280byte

#endif
